﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ToDoIt2.Aspects;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Collections.Specialized;
using pklib.ViewModel;
using ToDoIt2.Model.Persistent.UI;
using ToDoIt2.Model;
using MonitoredUndo;

namespace ToDoIt2.ViewModel {
	[SupportsUndo]
	[NotifyPropertyChanged]
	public class DocumentVM : ViewModelBase<Document> {
		public ObservableCollectionVM<TabPrefs, TabPrefsVM> Tabs { get; set; }

		public DocumentVM(Document Target) : base(Target) {
			this.Tabs = new ObservableCollectionVM<TabPrefs, TabPrefsVM>(this.Target.Tabs);

			this.Tabs.CollectionChanged += this.OnTabsCollectionChanged;
		}

		void  OnTabsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
			DefaultChangeFactory.OnCollectionChanged(this, "Tabs", this.Tabs, e);
		}
	}
}
